home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr47
/
pctuto.zip
/
BLOAD.COM
/
BLOAD.DOC
< prev
next >
Wrap
Text File
|
1990-08-06
|
9KB
|
228 lines
1
MAKEBLD AND STRIPBLD
There are two functions in BASIC called BSAVE and BLOAD. BSAVE
writes data from memory to disk and BLOAD reads data from disk
into memory. The disk file consists of seven bytes of BLOAD
information followed by an exact copy of what was in memory.
Using BSAVE and BLOAD is much faster than using the INPUT/WRITE
functions. It has two uses.
1) If you have a large array of data, you can transfer the
binary data directly to and from disk. This can make the
disk read 20 to 50 times faster. Instead of 20 seconds, it
might take 1 second.
2) If you have an assembler subroutine in binary format,
this is the only way to read it in. Using a binary file for
assembler subprograms has been outdated since QuickBasic
3.0, but you can do it if you feel like it.
The problem with BSAVE and BLOAD is twofold. First, if you have
data or an assembler subprogram which you want to load into
memory for the first time, BLOAD will not work since it needs
those first seven bytes of information. Secondly, if you save
data to disk and then want to use it with another programming
language, you may have some trouble because the first seven bytes
of the file are BLOAD information, not data.
MAKEBLD.COM is designed to put the correct information in the
first seven bytes of a file and then append the data. STRIPBLD is
designed to take away the first seven bytes of a legitimate BLOAD
file and leave the data which has been saved by BASIC.
To create a file which you can BLOAD, use MAKEBLD:
>makebld sourcefile bloadfile
where 'sourcefile' is the source data file that you want to alter
and 'bloadfile' is the name of the file which will be loaded into
memory. You must use the full filename (name + extension) for
both files. Pathnames are allowed.
To strip the BLOAD information from a file, use STRIPBLD:
>stripbld bloadfile datafile
where 'bloadfile' is the file which has been BSAVEd from memory
and 'datafile' is the file which contains only the data which was
in memory.
______________________
Copyright (C) 1990 Chuck Nelson
MAKEBLD AND STRIPBLD 2
____________________
POSSIBLE ERRORS
There are several error messages which you might receive from
these programs. These messages apply to both programs.
1) "Bad command line. Proper line is: ... "
You must enter both the source file and destination file on
the command line, and the progran has not detected two
entries on the command line.
2) "Can't open the first file"
"Can't open the second file"
The first file must exist and the second file must be a
valid filename or pathname.
3) "File too large"
There is an upper limit of 65535 bytes of binary data in a
bload file (excluding the bload information and any end of
file marker).
There are several error messages which you are not likely to see,
but here is what caused them.
4) "No room for i/o buffer"
There was less than about 2500 bytes of free memory when the
program was loaded and the program has no room for doing
i/o. This means that you are already using all of memory
with other programs.
5) "Bad file read"
"Bad file write"
These are DOS disk read/write errors.
In addition, there are several error messages that you might get
from STRIPBLD.
a) "Bad bload signature"
The program checks the first byte of the file for a value of
&HFD. If it finds a different value it will warn you. The
next line will contain a hex number. The two left digits
will be &H00, and the two right digits will be the hex value
of the first byte. This is probably not a bload file, but
the program will allow you to continue.
b) "Non-matching file sizes"
The program compares the file size to the size specified in
the bload information. If they are not equal, or if the file
is not one byte bigger (to allow for an end of file byte),
the program will signal the error. The next line will
contain a hex number which is [filesize - bloadsize]. The
length of the bload information is not included in this
calculation.
If either of these errors occurs, you will be prompted:
MAKEBLD AND STRIPBLD 3
____________________
"Do you want to continue? (y/n)"
Press 'Y' or 'y' to continue or any other key to exit. If you
continue, STRIPBLD will strip the first seven bytes and then make
a file which is the SMALLER of:
1) the data size from the bload information.
2) the size of the remaining file.
BLOAD INFORMATION
The seven byte bload header consists of:
BYTE INFORMATION
1 &HFD - the bload signature byte
2-3 segment where the data came from
4-5 offset where the information came from
6-7 length of the data
For those of you who do not know about the 8086 memory scheme,
bytes 2-5 give you the address in memory where the data started.
The size of the file is one word, so it is limited to the range
of 0 - 65535 bytes.
END OF FILE
BASIC may put and end of file marker at the end of the data when
it BSAVEs it. If STRIPBLD detects that the file is one byte too
long, it will assume that the last byte is an EOF marker and will
leave it out of the destination file. MAKEBLD puts no EOF marker
at the end of the file it creates.
The size of data in the BLOAD file created by MAKEBLD is seven
bytes less than the filesize. It is possible for EOF markers to
creep in when transfering data between programs, so if you have
an array, it is safer if you have one dummy array element at the
top to insure that the BLOAD file does not run past the array.
BINARY DATA
If you have a file with numeric data in it, it is easy to tell if
it is text data or binary data. Just enter:
>type filename
Your screen will show the contents of the file. If the screen
shows lots of non-numeric characters (or no visible characters),
it is a binary file. If the output is all digits, it is a text
file. BLOAD and BASVE are for binary, not text, data.
MAKEBLD AND STRIPBLD 4
____________________
REGISTRATION
There is no registration fee for these programs. The programs and
manual may be distributed as long as:
1) they remain unaltered and are distributed together as a
compressed LHARC file.
2) they are either distributed without cost or they make up
less than 5% (by filesize) of the files on a disk which is
being distributed for a fee.
Chuck Nelson
NELSOFT
P.O. Box 21389
Oakland, CA 94620
WARRANTY
THESE PROGRAMS AND INSTRUCTION MANUAL ARE BEING DISTRIBUTED
"AS IS", WITHOUT WARRANTY AS TO THEIR PERFORMANCE,
MERCHANTIBILITY, OR FITNESS FOR ANY PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE RESULTS AND PERFORMANCE OF THESE
PROGRAMS IS ASSUMED BY YOU.